const getLgger = require('./utils/logger.js')

class Context {
	constructor(ctx, app) {
   
    ctx.app = app
    ctx.appState = app.appState
    ctx.Exception = app.Exception
    ctx.successField = app.successField
    ctx.logger = getLgger('controller', app.loggerConfig)
    ctx.success = this.success
	}

	success(data) {
		this.body = { ...this.successField, data }
	}
}

module.exports = Context
